u8 opcode, modrm_reg = 0, modrm_rm = 0, rep_prefix = 0;
unsigned int port, i, op_bytes = 4, data, rc;
char io_emul_stub[16];
- void (*io_emul)(struct cpu_user_regs *) __attribute__((__regparm__(1))) \
- = (void*)&io_emul_stub[0];
+ void (*io_emul)(struct cpu_user_regs *) __attribute__((__regparm__(1)));
u32 l, h;
/* Legacy prefixes. */
*(s32 *)&io_emul_stub[9] =
(char *)guest_to_host_gpr_switch - &io_emul_stub[13];
+ /* Handy function-typed pointer to the stub. */
+ io_emul = (void *)io_emul_stub;
+
/* I/O Port and Interrupt Flag instructions. */
switch ( opcode )
{
if ( guest_inb_okay(port, v, regs) )
io_emul(regs);
else
- regs->eax = (regs->eax & ~0xffUL) | (u8)~0;
+ regs->eax |= (u8)~0;
break;
case 2:
if ( guest_inw_okay(port, v, regs) )
io_emul(regs);
else
- regs->eax = (regs->eax & ~0xffffUL) | (u16)~0;
+ regs->eax |= (u16)~0;
break;
case 4:
if ( guest_inl_okay(port, v, regs) )